*********************************************************************************
* Ergebnisse zum Abschnitt "Gruppenunterschiede" III							*
*********************************************************************************

* Project: 	Sonderheft ZfP
* Authors: 	Matthias Mader
* Date:		Jan 2025

* Data: secEUrity Project, IPSOS supplementary survey 2024

*********************************************************************************

*** Setup
	clear
	set more off            						// Disable partitioned output
	set dp period									// Use comma instead of dot for decimals
	set linesize 80         						// Line size limit to make output more readable
	macro drop _all         						// clear all macros
	set scheme burd, permanent						// set graph scheme, e.g., cleanplots, plottig, plotplainblind, burd3, s1mono
	graph set window fontface "Times New Roman"		// set font in graphs | "Arial" | "Times New Roman"


*** Open clean data set
	use DATA_clean, clear


*** Abbildung 3

	*Create data set based on following frequencies:

	bysort edu_cat1:	sum nss_russia_d2 nss_china_d2 nss_allies_d2 nss_nuclear_d2 
	bysort pint_d1:		sum nss_russia_d2 nss_china_d2 nss_allies_d2 nss_nuclear_d2 
	bysort pint_d2:		sum nss_russia_d2 nss_china_d2 nss_allies_d2 nss_nuclear_d2 

	tab pint_d2 nss_russia_d4, nof row
	tab pint_d2 nss_china_d4, nof row
	tab pint_d2 nss_allies_d4, nof row
	tab pint_d2 nss_nuclear_d4, nof row
	
	* --> Create DATA_aggregates_by_hand_THEMENPUBLIKUM.dta

	*Plot data
	use DATA_aggregates_by_hand_THEMENPUBLIKUM.dta, clear

	graph dot edu_lo edu_hi, over(item, sort(number) label(labsize(medlarge)) axis(noline)) ///
		name(g1, replace) ///
		scheme(burd) ///
		marker(1, msize(vlarge) msymbol(circle)	mcolor(178 24 43)) /// 
		marker(2, msize(vlarge) msymbol(circle) 	mcolor(33 102 172))   ///
		title(" ") /// 
		text(46 105  "{bf:Bildung gering}", col(178 24 43) size(medlarge) placement(west)) ///
		text(50 105  "{&minus}", col(black) size(large)) ///
		text(54 105  "{bf:Bildung hoch}", col(33 102 172) size(medlarge)  placement(east)) ///
		yscale(range(0 100)) ylabel(4 "0%" 12.5 " " 25 "25%" 37.5 " " 50 "50%" 62.5 " " 75 "75%" 87.5 " " 95 "100%", labsize(medlarge) ticks) ///
		text(54 92  "55", col(178 24 43) size(med)) ///
		text(43 67  "45", col(178 24 43) size(med)) ///
		text(46 42  "46", col(178 24 43) size(med)) ///
		text(44 17  "44", col(178 24 43) size(med)) ///
		text(65 92  "64", col(33 102 172) size(med)) ///
		text(55 67  "53", col(33 102 172) size(med)) ///
		text(65 42  "65", col(33 102 172) size(med)) ///
		text(55 17  "55", col(33 102 172) size(med)) ///
		ytitle(" ") ///
		yscale(off)  ylab(, grid) ///
		legend(off) ///
				plotregion(margin(zero) lcolor(none)) ///
		graphregion(margin(-5 5 0 0)) ///
		xsize(4) ysize(4)

	graph dot pint_lo pint_hi, over(item, sort(number) label(labsize(medlarge) labc(gs16)) axis(noline)) ///
		name(g2, replace) ///
		marker(1, msize(vlarge) msymbol(circle)	mcolor(178 24 43)) /// 
		marker(2, msize(vlarge) msymbol(circle) 	mcolor(33 102 172))   ///
		title(" ") /// 
		text(46 105  "{bf:Interesse gering}", col(178 24 43) size(medlarge) placement(west)) ///
		text(50 105  "{&minus}", col(black) size(large)) ///
		text(54 105  "{bf:Interesse hoch}", col(33 102 172) size(medlarge)  placement(east)) ///
		yscale(range(0 100)) ylabel(4 "0%" 12.5 " " 25 "25%" 37.5 " " 50 "50%" 62.5 " " 75 "75%" 87.5 " " 95 "100%", labsize(medlarge) ticks) ///
		ytitle(" ", size(med)) ///
		yscale(off)  ylab(,grid) ///
		text(54 92  "56", col(178 24 43) size(med)) ///
		text(35 67  "35", col(178 24 43) size(med)) ///
		text(41 42  "41", col(178 24 43) size(med)) ///
		text(42 17  "42", col(178 24 43) size(med)) ///
		text(66 92  "64", col(33 102 172) size(med)) ///
		text(57 67  "57", col(33 102 172) size(med)) ///
		text(68 42  "68", col(33 102 172) size(med)) ///
		text(59 17  "59", col(33 102 172) size(med)) ///
		legend(off) ///
		plotregion(margin(zero) lcolor(none)) ///
		graphregion(margin(-5 5 0 0)) ///
		xsize(4) ysize(4)

	*Teilabbildungen müssen händisch mit kombiniert werden.


*** Abbildung 6

	*Create data set based on following frequencies:
	use DATA_clean, clear

	bysort inter_d1:	sum nss_russia_d2 nss_china_d2 nss_allies_d2 nss_nuclear_d2
	bysort multi_d1:	sum nss_russia_d2 nss_china_d2 nss_allies_d2 nss_nuclear_d2
	bysort mili_d1:		sum nss_russia_d2 nss_china_d2 nss_allies_d2 nss_nuclear_d2

	* --> Create DATA_aggregates_by_hand_POSTURES.dta

	*Plot data
	use DATA_aggregates_by_hand_POSTURES.dta, clear

	graph dot inter_lo inter_hi, over(item, sort(number) label(labsize(medlarge)) axis(noline)) ///
		name(g3, replace) ///
		scheme(burd) ///
		marker(1, msize(vlarge) msymbol(circle)	mcolor(178 24 43)) /// 
		marker(2, msize(vlarge) msymbol(circle) 	mcolor(33 102 172))   ///
		title(" ") /// 
		text(30 105  "{bf:Isolationisten}", col(178 24 43) size(medlarge) placement(west)) ///
		text(34 105  "-", col(black) size(large)) ///
		text(38 105  "{bf:Internationalisten}", col(33 102 172) size(medlarge)  placement(east)) ///
		yscale(range(0 100)) ylabel(4 "0%" 12.5 " " 25 "25%" 37.5 " " 50 "50%" 62.5 " " 75 "75%" 87.5 " " 95 "100%", labsize(medlarge) ticks) ///
		text(53 92  "53", col(178 24 43) size(med)) ///
		text(49 67  "49", col(178 24 43) size(med)) ///
		text(52 42  "52", col(178 24 43) size(med)) ///
		text(50 17  "50", col(178 24 43) size(med)) ///
		text(81 92  "81", col(33 102 172) size(med)) ///
		text(58 67  "58", col(33 102 172) size(med)) ///
		text(80 42  "80", col(33 102 172) size(med)) ///
		text(62 17  "62", col(33 102 172) size(med)) ///
		ytitle(" ") ///
		yscale(off)  ylab(, grid) ///
		legend(off) ///
				plotregion(margin(zero) lcolor(none)) ///
		graphregion(margin(-5 10 0 0)) ///
		xsize(4) ysize(4)

	graph dot multi_lo multi_hi, over(item, sort(number) label(labsize(medlarge) labc(gs16)) axis(noline)) ///
		name(g4, replace) ///
		marker(1, msize(vlarge) msymbol(circle)	mcolor(178 24 43)) /// 
		marker(2, msize(vlarge) msymbol(circle) 	mcolor(33 102 172))   ///
		title(" ") /// 
		text(46 105  "{bf:Unilateralisten}", col(178 24 43) size(medlarge) placement(west)) ///
		text(50 105  "-", col(black) size(large)) ///
		text(54 105  "{bf:Multilateralisten}", col(33 102 172) size(medlarge)  placement(east)) ///
		yscale(range(0 100)) ylabel(4 "0%" 12.5 " " 25 "25%" 37.5 " " 50 "50%" 62.5 " " 75 "75%" 87.5 " " 95 "100%", labsize(medlarge)) ///
		ytitle(" ", size(med)) ///
		yscale(off)  ylab(,grid) ///
		text(36 92  "36", col(178 24 43) size(med)) ///
		text(40 67  "40", col(178 24 43) size(med)) ///
		text(33 42  "33", col(178 24 43) size(med)) ///
		text(33 17  "33", col(178 24 43) size(med)) ///
		text(74 92  "74", col(33 102 172) size(med)) ///
		text(57 67  "57", col(33 102 172) size(med)) ///
		text(75 42  "75", col(33 102 172) size(med)) ///
		text(64 17  "64", col(33 102 172) size(med)) ///
		legend(off) ///
		plotregion(margin(zero) lcolor(none)) ///
		graphregion(margin(-5 10 0 0)) ///
		xsize(4) ysize(4)


	graph dot force_lo force_hi, over(item, sort(number) label(labsize(medlarge) labc(gs16)) axis(noline)) ///
		name(g5, replace) ///
		marker(1, msize(vlarge) msymbol(circle)	mcolor(178 24 43)) /// 
		marker(2, msize(vlarge) msymbol(circle) 	mcolor(33 102 172))   ///
		title(" ") /// 
		text(46 105  "{bf:Tauben}", col(178 24 43) size(medlarge) placement(west)) ///
		text(50 105  "-", col(black) size(large)) ///
		text(54 105  "{bf:Falken}", col(33 102 172) size(medlarge)  placement(east)) ///
		yscale(range(0 100)) ylabel(4 "0%" 12.5 " " 25 "25%" 37.5 " " 50 "50%" 62.5 " " 75 "75%" 87.5 " " 95 "100%", labsize(medlarge)) ///
		ytitle(" ", size(med)) ///
		yscale(off) ylab(,grid) ///
		text(57 92  "57", col(178 24 43) size(med)) ///
		text(48 67  "48", col(178 24 43) size(med)) ///
		text(56 42  "56", col(178 24 43) size(med)) ///
		text(47 17  "47", col(178 24 43) size(med)) ///
		text(72 92  "72", col(33 102 172) size(med)) ///
		text(58 67  "58", col(33 102 172) size(med)) ///
		text(73 42  "73", col(33 102 172) size(med)) ///
		text(66 17  "66", col(33 102 172) size(med)) ///
		legend(off) ///
		plotregion(margin(zero) lcolor(none)) ///
		graphregion(margin(-5 10 0 0)) ///
		xsize(4) ysize(4)
